home *** CD-ROM | disk | FTP | other *** search
- // Copyright (C) 1997-2002 Alias|Wavefront,
- // a division of Silicon Graphics Limited.
- //
- // The information in this file is provided for the exclusive use of the
- // licensees of Alias|Wavefront. Such users have the right to use, modify,
- // and incorporate this code into other products for purposes authorized
- // by the Alias|Wavefront license agreement, without fee.
- //
- // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- // PERFORMANCE OF THIS SOFTWARE.
- //
- //
- // Alias|Wavefront Script File
- // MODIFY THIS AT YOUR OWN RISK
- //
- // Creation Date: December 16, 1996
- //
- // Description:
- // This script creates a panel which has a button line and a hyper panel
- // in it.
- //
- // Input Arguments:
- // panel name
- //
- // Return Value:
- // None.
- //
-
- global proc createHyperGraphPanel (string $whichPanel)
- //
- // Description:
- // Define the editors that are used in this panel. No
- // controls (widgets) are created at this point.
- // Adds support for the context sensitive help menu items.
- //
- {
- // create unique names for editors based on panel name
- //
- string $hyperGraphEd = ($whichPanel + "HyperGraphEd");
- string $nameFilter = ($hyperGraphEd + "NameFilter");
-
- hyperGraph
- -unParent
- -popupMenuScript "HyperGraphEdMenu"
- $hyperGraphEd;
-
- if (`exists hyperUserInit`) hyperUserInit $hyperGraphEd;
-
- // Add support for the Context Sensitive Help Menu.
- //
- addContextHelpProc $whichPanel "buildHyperGraphContextHelpItems";
- }
-
- global proc initHyperGraphPanel (string $whichPanel)
- //
- // Description:
- // Called on file -new/open.
- //
- {
- string $hyperGraphEd = ($whichPanel + "HyperGraphEd");
-
- hyperGraph -e -filter "" $hyperGraphEd;
- }
-
- global proc addHyperGraphPanel (string $whichPanel)
- //
- // Description:
- // Add the panel to a layout.
- // Parent the editors to that layout and create any other
- // controls (widgets) required.
- //
- {
- string $hyperGraphEd = ($whichPanel + "HyperGraphEd");
-
- waitCursor -state on;
-
- // Make sure that there is no template active
- setUITemplate -pushTemplate NONE;
-
- // Create Menu Bar, which will use exactly the same menu entries as the popupMenu
- // on the background of the hyperPanel
-
- // menuBarLayout hyperGraphMenu;
- // setParent -menu ..;
-
- // If this is the first Hypergraph to be created in this session
- // then get all of the options from the optionVars.
- //
- global int $gFirstHypergraph = 0;
- if ($gFirstHypergraph == 0) {
- $gFirstHypergraph = 1;
-
- // Set default state for Display preferences
- //
- if (!`optionVar -exists hypergraphDisplayShapeNodes`) {
- optionVar -intValue hypergraphDisplayShapeNodes 0;
- }
- if (!`optionVar -exists hypergraphDisplayInvisibleNodes`) {
- optionVar -intValue hypergraphDisplayInvisibleNodes 0;
- }
- if (!`optionVar -exists hypergraphDisplayUnderworldNodes`) {
- optionVar -intValue hypergraphDisplayUnderworldNodes 0;
- }
- if (!`optionVar -exists hypergraphDisplayExpressions`) {
- optionVar -intValue hypergraphDisplayExpressions 0;
- }
- if (!`optionVar -exists hypergraphDisplayConstraints`) {
- optionVar -intValue hypergraphDisplayConstraints 0;
- }
- if (!`optionVar -exists hypergraphDisplayDeformers`) {
- optionVar -intValue hypergraphDisplayDeformers 0;
- }
- if (!`optionVar -exists hypergraphDisplayImage`) {
- optionVar -intValue hypergraphDisplayImage 0;
- }
-
- hyperGraph -e -showShapes `optionVar -q hypergraphDisplayShapeNodes` $hyperGraphEd;
- hyperGraph -e -showInvisible `optionVar -q hypergraphDisplayInvisibleNodes` $hyperGraphEd;
- hyperGraph -e -showUnderworld `optionVar -q hypergraphDisplayUnderworldNodes` $hyperGraphEd;
- hyperGraph -e -showExpressions `optionVar -q hypergraphDisplayExpressions` $hyperGraphEd;
- hyperGraph -e -showConstraints `optionVar -q hypergraphDisplayConstraints` $hyperGraphEd;
- hyperGraph -e -showDeformers `optionVar -q hypergraphDisplayDeformers` $hyperGraphEd;
- hyperGraph -e -imageEnabled `optionVar -q hypergraphDisplayImage` $hyperGraphEd;
-
- // Set default state for Orientation preferences
- //
- if (!`optionVar -exists hypergraphOrientation`) {
- optionVar -stringValue hypergraphOrientation "horiz";
- }
- hyperGraph -e -orientation `optionVar -q hypergraphOrientation` $hyperGraphEd;
-
- // Set default state for Layout preferences
- //
- if (!`optionVar -exists hypergraphFreeform`) {
- optionVar -intValue hypergraphFreeform 0;
- }
- hyperGraph -e -freeform `optionVar -q hypergraphFreeform` $hyperGraphEd;
-
- // Set default state for Update preferences
- //
- if (!`optionVar -exists hypergraphUpdateSelection`) {
- optionVar -intValue hypergraphUpdateSelection 1;
- }
- if (!`optionVar -exists hypergraphUpdateNodeAdded`) {
- optionVar -intValue hypergraphUpdateNodeAdded 1;
- }
- hyperGraph -e -updateSelection `optionVar -q hypergraphUpdateSelection` $hyperGraphEd;
- hyperGraph -e -updateNodeAdded `optionVar -q hypergraphUpdateNodeAdded` $hyperGraphEd;
- }
-
- formLayout baseForm;
- frameLayout
- -visible true
- -borderVisible false
- -labelVisible false
- -collapsable false
- -collapse true
- -borderStyle "in"
- toolbarFrame;
- string $toolBarForm = `formLayout -visible true toolbarForm`;
-
- //
- // Create quick access buttons which will be hoocked up later,
- // so they can be in sync with the menu as well as the popupMenu.
- //
-
- int $iconsize = 26;
-
- setParent toolbarForm;
-
- separator -horizontal false -style single hgSeparator1;
-
- iconTextButton
- -i1 "frameGraph.xpm"
- -w $iconsize -h $iconsize
- -annotation "Frame All"
- frameGraphButton;
-
- iconTextButton
- -i1 "frameSelection.xpm"
- -w $iconsize -h $iconsize
- -annotation "Frame Selection"
- frameSelectionButton;
-
- iconTextButton
- -i1 "frameHierarchy.xpm"
- -w $iconsize -h $iconsize
- -annotation "Frame Hierarchy"
- frameHierButton;
-
- iconTextButton
- -i1 "frameBranch.xpm"
- -w $iconsize -h $iconsize
- -annotation "Frame Branch"
- frameBranchButton;
-
- separator -horizontal false -style single hgSeparator2;
-
- iconTextButton
- -i1 "showDag.xpm"
- -w $iconsize -h $iconsize
- -annotation "Scene Hierarchy"
- showDAGButton;
-
- iconTextButton
- -i1 "showDepend.xpm"
- -w $iconsize -h $iconsize
- -annotation "Input and Output Connections"
- showDGButton;
-
- separator -horizontal false -style single hgSeparator3;
-
- iconTextButton
- -i1 "addBookmark.xpm"
- -w $iconsize -h $iconsize
- -annotation "Create Bookmark"
- addBookmarkButton;
-
- iconTextButton
- -i1 "editBookmark.xpm"
- -w $iconsize -h $iconsize
- -annotation "Bookmark Editor..."
- editBookmarkButton;
-
- separator -horizontal false -style single hgSeparator4;
-
- iconTextCheckBox
- -w $iconsize -h $iconsize
- -annotation "Toggle Freeform/Automatic Layout Mode"
- freeformButton;
-
- // Set up the initial value
- if (`hyperGraph -q -freeform $hyperGraphEd`) {
- iconTextCheckBox -edit
- -i1 "freeformOn.xpm"
- -value true
- freeformButton;
- } else {
- iconTextCheckBox -edit
- -i1 "freeformOff.xpm"
- -value false
- freeformButton;
- }
-
- separator -horizontal false -style single rightSeparator;
-
- string $filterField
- = filterUICreateField($hyperGraphEd, $toolBarForm);
-
- formLayout -edit
- -attachForm $filterField "left" 0
-
- -attachControl hgSeparator1 "left" 0 $filterField
- -attachForm hgSeparator1 "top" 1
- -attachForm hgSeparator1 "bottom" 1
-
- -attachControl frameGraphButton "left" 0 hgSeparator1
- -attachControl frameSelectionButton "left" 0 frameGraphButton
- -attachControl frameHierButton "left" 0 frameSelectionButton
- -attachControl frameBranchButton "left" 0 frameHierButton
-
- -attachControl hgSeparator2 "left" 0 frameBranchButton
- -attachForm hgSeparator2 "top" 1
- -attachForm hgSeparator2 "bottom" 1
-
- -attachControl showDAGButton "left" 0 hgSeparator2
- -attachControl showDGButton "left" 0 showDAGButton
-
- -attachControl hgSeparator3 "left" 0 showDGButton
- -attachForm hgSeparator3 "top" 1
- -attachForm hgSeparator3 "bottom" 1
-
- -attachControl addBookmarkButton "left" 0 hgSeparator3
- -attachControl editBookmarkButton "left" 0 addBookmarkButton
-
- -attachControl hgSeparator4 "left" 0 editBookmarkButton
- -attachForm hgSeparator4 "top" 1
- -attachForm hgSeparator4 "bottom" 1
-
- -attachControl freeformButton "left" 0 hgSeparator4
-
- -attachControl rightSeparator "left" 0 freeformButton
- -attachForm rightSeparator "top" 1
- -attachForm rightSeparator "bottom" 1
- toolbarForm;
- setParent ..;
- setParent baseForm;
-
- //
- // Parent the editors to the editor layout
- //
-
- hyperGraph -edit -parent baseForm $hyperGraphEd;
- formLayout -edit
- -attachForm toolbarFrame top 0
- -attachForm toolbarFrame left 0
- -attachForm toolbarFrame right 0
- -attachForm $hyperGraphEd left 0
- -attachForm $hyperGraphEd right 0
- -attachForm $hyperGraphEd bottom 0
- -attachControl $hyperGraphEd top 0 toolbarFrame
- baseForm;
- setParent -top;
-
- // Attach a procedure that will limit the kinds of filters displayed
- // in the Hyper Graph's filter menus.
- //
- filterUISetRelatedFiltersProcedure($hyperGraphEd, "hyperGraphFilterCategories");
-
- setUITemplate -popTemplate;
-
- waitCursor -state off;
- }
-
- global proc removeHyperGraphPanel (string $whichPanel)
- //
- // Description:
- // Remove the panel from a layout.
- // Delete controls.
- //
- {
- string $hyperGraphEd = ($whichPanel + "HyperGraphEd");
-
- if (`hyperGraph -exists $hyperGraphEd`) {
- hyperGraph -edit -unParent $hyperGraphEd;
- }
-
- filterUIRemoveView($hyperGraphEd);
- }
-
- global proc deleteHyperGraphPanel (string $whichPanel)
- //
- // Description:
- // This proc will delete the contents of the panel, but not
- // the panel itself.
- //
- // Note:
- // We only need to delete editors here. Other UI will be taken care of
- // by the remove proc.
- //
- {
- string $hyperGraphEd = ($whichPanel + "HyperGraphEd");
-
- if (`hyperGraph -exists $hyperGraphEd`) {
- deleteUI -editor $hyperGraphEd;
- }
- }
-
- global proc string saveStateHyperGraphPanel (string $whichPanel)
- //
- // Description:
- // This proc returns a string that when executed will restore the
- // current state of the panel elements.
- //
- {
- string $indent = "\n\t\t\t";
- string $hyperGraphEd = ($whichPanel + "HyperGraphEd");
-
- return (
- $indent + "$editorName = ($panelName+\"HyperGraphEd\");\n" +
- `hyperGraph -query -stateString $hyperGraphEd`
- );
- }
-
- global proc hyperGraphPanel (string $panelName)
- //
- // Description:
- // Create a new scripted fullGraphPanel. If the scripted
- // panel hasn't yet been defined then define it.
- //
- {
- global string $gMainPane;
-
- if (!`scriptedPanelType -exists hyperGraphPanel`) {
- //
- // Define the callbacks for the hyperGraphPanel
- //
- scriptedPanelType
- -unique true
- -createCallback "createHyperGraphPanel"
- -initCallback "initHyperGraphPanel"
- -addCallback "addHyperGraphPanel"
- -removeCallback "removeHyperGraphPanel"
- -deleteCallback "deleteHyperGraphPanel"
- -saveStateCallback "saveStateHyperGraphPanel"
- hyperGraphPanel;
- }
-
- // instantiate a new hyperGraphPanel
- //
- setParent $gMainPane;
- scriptedPanel -unParent -type hyperGraphPanel $panelName;
- }
-
- global proc buildHyperGraphContextHelpItems(string $nameRoot, string $menuParent)
- //
- // Description:
- // Build context sensitive menu items for the hyper graph.
- //
- // Input Arguments:
- // $nameRoot - name to use as the root of all item names
- // $menuParent - the name of the parent of this menu
- //
- // Return Value:
- // None
- //
- {
- menuItem -label "Help on Hypergraph..."
- -enableCommandRepeat false
- -command "showHelp Hypergraph";
- }
-
- global proc string [] hyperGraphFilterCategories()
- //
- // Description:
- // Return the types of filters that the Hyper Graph will display
- // in its "Show->Objects" filter menu.
- //
- {
- string $result[] = { "Modeling", "Camera", "Animating", "Lighting" };
- return $result;
- }
-